package com.sdy.hospitalguard.biz.event;

import lombok.Getter;
import org.springframework.context.ApplicationEvent;

import java.util.UUID;

/**
 * Websocket 事件
 */
public class WebsocketEvent extends ApplicationEvent {
    private static final long serialVersionUID = 1L;
    @Getter
    private Integer userId;
    @Getter
    private String eventType;
    @Getter
    private Object data;
    @Getter
    private String eventId;
    @Getter
    private Class<? extends WebsocketEventCallback> callback;
    
    public WebsocketEvent() {
        super("");
    }

    public WebsocketEvent(Object source, Integer userId, String eventType, Object data, Class<? extends WebsocketEventCallback> callback) {
        super(source);
        this.eventId = UUID.randomUUID().toString();
        this.userId = userId;
        this.eventType = eventType;
        this.data = data;
        this.callback = callback;
    }
}
